<?php
if (!isset($update)) {
    ?>
    <div id="post-photo-form" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

        <div class="modal-header">
    	<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    	<h3 id="myModalLabel">Post Photo</h3>
        </div>
    <?php } ?>    
    <?php
    $form = $this->beginWidget('CActiveForm', array(
	'id' => 'post-form',
	'enableAjaxValidation' => FALSE,
	'enableClientValidation' => true,
	'clientOptions' => array(
	    'validateOnSubmit' => true
	),
	'htmlOptions' => array(
	    'class' => 'form-horizontal',
	    'enctype' => "multipart/form-data"
	)
    ));
    ?>	
    <div class="<?php
    if (!isset($update))
	echo 'modal-body';
    else
	echo 'edit-post-body'
	?>">
	<p>	    
	    <?php
	    echo $form->label($model, 'title');
	    echo $form->textField($model, 'title', array('class' => 'input-post'));
	    echo $form->error($model, 'title');

	    echo $form->label($model, 'content');
	    echo $form->textArea($model, 'content', array('class' => 'input-post'));
	    echo $form->error($model, 'content');
	    ?>
	    <label>Photo</label>	    	    
	    <input type='file' accept='image/*' name='photo[]'/>		   
	    <br>
	    <br>
	    <select class="select-type-addition">
		<option value="">Add Content</option>
		<option value="photo">Photo</option>
		<option value="audio">Audio</option>
		<option value="video">Video</option>
	    </select>
	    <a href="javascript:void(0)" class="btn btn-primary btn-add-addition" type-post='photo'>Add</a>
	    <span class='wrap-upload-addition'>
	    </span>
	    <?php
	    echo $form->label($model, 'tags');
	    echo $form->textField($model, 'tags', array('class' => 'input-post'));
	    echo $form->error($model, 'tags');

//	    echo $form->label($model, 'is_private');
//	    echo $form->dropDownList($model, 'is_private', array('0' => 'Public', '1' => 'Private'), array('class' => 'input-post'));
//	    echo $form->error($model, 'is_private');
	    ?>


	    <input type='hidden' value="<?php echo Posts::TYPE_PHOTO ?>" name="Posts[post_type]"/>

	    <?php
	    /*
	      <br>
	      <a id="more-input-file" style="color: blue;cursor: pointer;"><i class="icon-plus"></i> Add more images</a>
	     */
	    ?>

	</p>
    </div>

    <div class="modal-footer">
	<?php if (!isset($update)) { ?>
    	<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
	<?php } ?>
	<input type="submit" class="btn btn-info" value="Create" name='posting'/>
    </div>
    <?php
    $this->endWidget();
    ?>
    <?php
    if (!isset($update)) {
	?>
    </div>
    <?php
}?>